﻿using System;
using System.Collections.Generic;
using System.Text;
using ZLDC.Common.Estate;
using System.Data;

namespace ZLDC.Topo.BLL.Estate
{
   public  class HousingFollowBLL
    {
              public static string p_housingFollow_save(int Id, int housingId, string followType, int fdeptId, string fdept, int fUserId, string fUser, string fContent, int dltFlag, string fImportant)
       {
           string outmsg = "";
           int newid = 0;

            using (_Database db = new _Database("estate"))
            {
                ZLDC.DAL.Estate.HousingFollowDAL.p_housingFollow_save( Id,  housingId,  followType,  fdeptId, fdept,  fUserId,  fUser,  fContent,  dltFlag,fImportant, out outmsg, out newid, db);
            }

            return outmsg;
       
       }

       public static string p_housingFollow_save(int Id, int housingId, string followType, int fdeptId, string fdept, int fUserId, string fUser, string fContent, int dltFlag, string fImportant, ref int newid)
       {
           string outmsg = "";
          
           using (_Database db = new _Database("estate"))
           {
               ZLDC.DAL.Estate.HousingFollowDAL.p_housingFollow_save(Id, housingId, followType, fdeptId, fdept, fUserId, fUser, fContent, dltFlag, fImportant, out outmsg, out newid, db);
           }

           return outmsg;
       }

                                                       public static string p_housingFollow_delete(int Id)
       {
           string outmsg = "";

           using (_Database db = new _Database("estate"))
           {
               ZLDC.DAL.Estate.HousingFollowDAL.p_housingFollow_delete( Id, out  outmsg, db);
           }

           return outmsg;
       }
                                                                      public static string p_housingFollow_list_table(int page, int pagesize, int housingId,int deptid)
       {
           DataTable dt = null;
           int total = 0;                      int pageall = 0;         
           using (_Database db = new _Database("estate"))
           {
               if (pagesize == 6)
                   dt = ZLDC.DAL.Estate.HousingFollowDAL.p_housingFollow_list_table(page, pagesize, housingId, deptid, ref total, db);
               else
                   dt = ZLDC.DAL.Estate.HousingFollowDAL.p_housingFollow_list_top50_table(page, pagesize, housingId, ref total, db);
           }

           pageall = _Utility.GetPageAll(pagesize, total);      
           _Json json = new _Json(dt,"yyyy-MM-dd HH:mm:ss");
           return "{page:{currentpage:'" + page + "',pagesize:'" + pagesize + "',total:'" + total + "',pageall:'" + pageall + "'},record:" + json.ToJson() + "}";

       }
                                                        public static string p_housingFollowReport_list_table(int page, int pagesize,string condition) 
       {
           DataTable dt = null;
           int total = 0;
           int pageall = 0;
           using (_Database db = new _Database("estate")) 
           {
               dt = ZLDC.DAL.Estate.HousingFollowDAL.p_housingFollowReport_list_table(page, pagesize, condition, ref total, db);

           }
           pageall = _Utility.GetPageAll(pagesize, total);                 _Json json = new _Json(dt, "yyyy-MM-dd HH:mm:ss");
           return "{page:{currentpage:'" + page + "',pagesize:'" + pagesize + "',total:'" + total + "',pageall:'" + pageall + "'},record:" + json.ToJson() + "}";

       }
      
    }
}
